package com.wc.codeforces.模拟.Rudolf_and_121;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/6/23 21:12
 * @description https://codeforces.com/problemset/problem/1941/B
 */
public class Main {
    /**
     * 思路：
     * 模拟，可以很巧妙的运用第一个数，是只能由第二个数改造
     * 那么将以第一个数改成0，那么第二个数就成了第一个数，以此类推
     * 最后只需要判断所有数是不是都是0就好了
     * 如果只判断最后一个数不等于0的时候，例如 1 3 1, 就不满足了
     * 需要判断a[n] != 0和 a[n - 1] != 0 就可以了
     */
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 200010;
    static int[] a = new int[N];
    static int n;

    public static void main(String[] args) {
        int T = sc.nextInt();
        while (T-- > 0) {
            n = sc.nextInt();
            for (int i = 1; i <= n; i++) a[i] = sc.nextInt();
            boolean res = true;
            for (int i = 2; i < n; i++) {
                if (a[i - 1] >= 0) {
                    a[i] -= a[i - 1] * 2;
                    a[i + 1] -= a[i - 1];
                    a[i - 1] = 0;
                } else {
                    res = false;
                    break;
                }
            }
            if (a[n] != 0 || a[n - 1] != 0) res = false;
            if (res) out.println("YES");
            else out.println("NO");
        }
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
